package com.jeesite.modules.gallery.entity;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import jakarta.validation.constraints.Size;

import com.jeesite.common.entity.DataEntity;
import com.jeesite.common.mybatis.annotation.Column;
import com.jeesite.common.mybatis.annotation.Table;
import com.jeesite.common.mybatis.mapper.query.QueryType;
import org.springframework.web.multipart.MultipartFile;

import java.io.Serial;

/**
 * galleryEntity
 * @author LaVenderGong
 * @version 2025-08-23
 */
@Table(name="gallery", alias="a", label="gallery信息", columns={
		@Column(name="id", attrName="tid", label="id", isPK=true),
		@Column(name="title", attrName="title", label="title", queryType=QueryType.LIKE),
		@Column(name="url", attrName="url", label="url"),
		@Column(name="location", attrName="location", label="location"),
		@Column(name="description", attrName="description", label="description"),
	}, orderBy="a.id DESC"
)
public class Gallery extends DataEntity<Gallery> {

	@Serial
	private static final long serialVersionUID = 1L;
	private Long tid;		// id
	private String title;		// title
	private String url;		// url
	private String location;		// location
	private String description;		// description
	private MultipartFile imageFile;

	public MultipartFile getImageFile() {
		return imageFile;
	}

	public void setImageFile(MultipartFile imageFile) {
		this.imageFile = imageFile;
	}

	public Gallery() {
		this(null);
	}

	public Gallery(String id){
		super(id);
	}

	@JsonSerialize(using = ToStringSerializer.class)
	public Long getTid() {
		return tid;
	}

	public void setTid(Long tid) {
		this.tid = tid;
	}

	@Size(min=0, max=50, message="title长度不能超过 50 个字符")
	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public String getUrl() {
		return url;
	}

	public void setUrl(String url) {
		this.url = url;
	}

	@Size(min=0, max=50, message="location长度不能超过 50 个字符")
	public String getLocation() {
		return location;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	@Override
	public String toString() {
		return "Gallery{" +
				"tid=" + tid +
				", title='" + title + '\'' +
				", url='" + url + '\'' +
				", location='" + location + '\'' +
				", description='" + description + '\'' +
				", imageFile=" + imageFile +
				'}';
	}
}
